package com.example.yimai.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Data
@TableName("easybuy_product")
@Document(indexName = "product")
public class Product {
    @Id
    @TableId(type = IdType.AUTO)
    private String id;
    @Field(type = FieldType.Text)
    private String name;
    @Field(type = FieldType.Text)
    private String description;
    @Field(type = FieldType.Float)
    private float price;
    @Field(type = FieldType.Integer)
    private int stock;
    @Field(type = FieldType.Integer)
    private int categoryLevel1Id;
    @Field(type = FieldType.Integer)
    private int categoryLevel2Id;
    @Field(type = FieldType.Integer)
    private int categoryLevel3Id;
    @Field(type = FieldType.Text)
    private String fileName;
    @Field(type = FieldType.Integer)
    private int lockedStock;
    @TableLogic(value = "0", delval = "1")
    private int isDelete = 0;
}
